From 584c9c8a022349bd5f7519a8289302563219be1c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 1 Jul 2009 15:11:03 -0400 Subject: [PATCH] Make stock buttons have mnemonics again We used to treat stock buttons as having an implicit use-underline. A recent but fix lost that. --- gtk/gtkbutton.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 43ec81853b..c5757ac822 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -934,15 +934,15 @@ gtk_button_construct_child (GtkButton *button) GtkWidget *image = NULL; gchar *label_text = NULL; gint image_spacing; - + if (!button->constructed) return; - + if (!button->label_text && !priv->image) return; - - gtk_widget_style_get (GTK_WIDGET (button), - "image-spacing", &image_spacing, + + gtk_widget_style_get (GTK_WIDGET (button), + "image-spacing", &image_spacing, NULL); if (priv->image && !priv->image_is_stock) @@ -951,7 +951,7 @@ gtk_button_construct_child (GtkButton *button) if (image->parent) gtk_container_remove (GTK_CONTAINER (image->parent), image); } - + priv->image = NULL; if (GTK_BIN (button)->child) @@ -973,7 +973,7 @@ gtk_button_construct_child (GtkButton *button) if (image) { priv->image = image; - g_object_set (priv->image, + g_object_set (priv->image, "visible", show_image (button), "no-show-all", TRUE, NULL); @@ -997,7 +997,7 @@ gtk_button_construct_child (GtkButton *button) if (label_text) { - if (button->use_underline) + if (button->use_underline || button->use_stock) { label = gtk_label_new_with_mnemonic (label_text); gtk_label_set_mnemonic_widget (GTK_LABEL (label), @@ -1012,7 +1012,7 @@ gtk_button_construct_child (GtkButton *button) else gtk_box_pack_end (GTK_BOX (box), label, FALSE, FALSE, 0); } - + gtk_container_add (GTK_CONTAINER (button), align); gtk_container_add (GTK_CONTAINER (align), box); gtk_widget_show_all (align); @@ -1021,18 +1021,18 @@ gtk_button_construct_child (GtkButton *button) return; } - - if (button->use_underline) + + if (button->use_underline || button->use_stock) { label = gtk_label_new_with_mnemonic (button->label_text); gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button)); } else label = gtk_label_new (button->label_text); - + if (priv->align_set) gtk_misc_set_alignment (GTK_MISC (label), priv->xalign, priv->yalign); - + gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (button), label); } -- 2.30.2